<?php
class Action extends Zend_Db_Table {
	protected $_name = "cc_action";
	
	private $db;
	
	/**
	 * 
	 * @access public
	 * @return 
	 */
	public function __construct(){
		$this->db = Zend_Db_Table::getDefaultAdapter();
		
		parent::_setup();
	}
	
	/**
	 * 新增动作
	 * @access public
	 * @return int 
	 */
	public function insAct($data){
		$lastid = $this->insert($data);
		return $lastid;
	}
	/**
	 * 修改动作
	 * @access public
	 * @return 
	 */
	public function updAct($data,$id){
		$where = $this->db->quoteInto("id=?",$id);
		$updcnt = $this->update($data,$where);
		return $updcnt;
	}
	/**
	 * 删除动作
	 * @access public
	 * @return int
	 */
	public function delAct($id){
		$where = $this->db->quoteInto("id = ?",$id);
		$lastid = $this->delete($where);
		return $lastid;
	}
	/**
	 * 取所有动作
	 * @access public
	 * @return array 
	 */
	public function getAllAct(){
		$rowset = $this->fetchAll();
		$actArr = $rowset->toArray();
		return $actArr;
	}
	/**
	 * 取指定ID动作
	 * @access public
	 * @return array 指定ID的动作数组
	 */
	public function getActById($id){
		$where = $this->db->quoteInto('id=?',$id);
		$rowset = $this->fetchRow($where);
		$actArr = $rowset->toArray();
		return $actArr;
	}
	
	
}
